package com.springbootdubbo.consumer;

import com.alibaba.dubbo.config.annotation.Reference;

import com.springbootdubbo.model.City;
import com.springbootdubbo.service.CityDubboService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;


@RestController
public class CityDubboConsumerService {

  @Reference(version = "1.0")
//  @Inject
  private CityDubboService cityDubboService;


  @RequestMapping("/getcity")
  @ResponseBody
  public City printCity() {

    System.out.println("--getcity--");
    String cityName = "22";
    City city = new City();
    city = cityDubboService.findCityByName(cityName);
    System.out.println(city.toString());
    return city;
  }
}